package pers.xiaojun.boot.common.exception;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import pers.xiaojun.boot.common.pojo.BusinessCode;

/**
 * 业务异常
 *
 * @author xiaojun
 * @since 2025-10-04
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BusinessException extends RuntimeException {

    /**
     * 异常代码
     */
    private Integer code;

    /**
     * 异常消息
     */
    private String message;


    public BusinessException(BusinessCode businessCode) {
        this.code = businessCode.getCode();
        this.message = businessCode.getMessage();
    }
}
